﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;


namespace Planetwork
{
    public partial class Default : System.Web.UI.Page
    {
        static string conStr = ConfigurationManager.AppSettings["conStr"];
        SqlConnection mycon = new SqlConnection(conStr);

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        /// <summary>
        /// 数据源绑定
        /// </summary>
        void BindData()
        {
            string sql = "select *from DefaultImage";
            SqlDataAdapter mydat = new SqlDataAdapter(sql, mycon);
            DataSet myds = new DataSet();

            mycon.Open();
            mydat.Fill(myds);
            mycon.Close();

            if(myds.Tables[0].Rows.Count > 0)
            {
                this.showImageList.DataSource = myds.Tables[0];
                this.showImageList.DataBind();
            }
        }
    }
}